package com.baizhi.controller;

import com.baizhi.entity.Article;
import com.baizhi.lucene.LuceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2019/4/16.
 */
@Controller
@RequestMapping("/LuceneController")
public class LuceneController {
    @Autowired
    private LuceneService luceneService;

    @RequestMapping("/resetIndexDB.do")
    @ResponseBody
    public Map resetIndexDB(){
        return luceneService.resetIndexDB();
    }

    @RequestMapping("/queryByKeyword.do")
    @ResponseBody
    public List<Article> queryByKeyword(String key){
        return luceneService.queryByKeyword(key);
    }

}
